# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php8-pecl-varnish
_extname=varnish
pkgver=1.2.6
pkgrel=1
pkgdesc="PHP 8 extension: makes it possible to interact with a running varnish instance through TCP socket or shared memory."
url="https://pecl.php.net/package/varnish"
arch="all"
license="BSD-3-Clause"
depends="php8-common"
makedepends="php8-dev varnish-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"
provides="php7-varnish=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-varnish" # for backward compatibility

build() {
	phpize8
	./configure --prefix=/usr --with-php-config=php-config8
	make
}

check() {
	php8 -dextension=modules/$_extname.so --ri $_extname
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php8/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="d17e285a134d2541ddea2bfc8627bc4926b3dbeeee1e9c729cd49c17608030764435662148b0dc43dc0eb1eab5d5dc8fd88c86aca40178afaf1ec85fa3e63aae  php-pecl-varnish-1.2.6.tgz"
